#pragma once
#ifndef __FILELOADER_H__
#define __FILELOADER_H__

#include "NezhaFoundation.h"

class Nezha::stream::IReadFile;

class cFileLoader
{
public:
	cFileLoader();
	~cFileLoader();

	bool Open( const _string& pathName, bool useMemory  );

	bool OpenNoPack( const _string& pathName, bool useMemory );

	int Close();

	unsigned int Read( void* buffer, unsigned int bytes );

	bool ReadInt( int* value );
	bool ReadUnsignedInt( unsigned int* value );
	bool ReadFloat( float* value );

	unsigned int ReadLine( char* buffer, unsigned int bufferSize );

	int Seek( unsigned int offset, int origin = SEEK_SET );

	unsigned int Tell() const;

	unsigned int GetSize() const;

	Nezha::stream::IReadFile* GetFile() const;

	const char* GetBufferPtr();

	bool IsEnd() const;

	bool IsEmpty() const;

	bool IsMemUsed() const;

private:

	bool mMemUsed;

	Nezha::stream::IReadFile* mReadFile;
};

inline Nezha::stream::IReadFile* cFileLoader::GetFile() const
{
	return mReadFile;
}

inline bool cFileLoader::IsMemUsed() const
{
	return mMemUsed;
}

#endif // __FILELOADER_H__